package top.hkyzf.study.leetcode.graph;

import org.junit.Test;

/**
 * @author 朱峰
 * @date 2022-2-18 9:12
 */
public class 找出星型图的中心节点_1791 {
    public int findCenter(int[][] edges) {
        int v1 = edges[0][0];
        int v2 = edges[0][1];
        int v3 = edges[1][0];
        int v4 = edges[1][1];
        if (v1 == v3) {
            return v1;
        }
        if (v1 == v4) {
            return v1;
        }
        return v2;
    }

    @Test
    public void testFindCenter () {
        int[][] edges = {{1,2},{5,1},{1,3},{1,4}};
        System.out.println(findCenter(edges));
    }
}
